<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ArticleRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'cateid'    =>  'required|numeric',
            'name'      =>  'required|string',
            'content'   =>  'required',
            'thumb'     =>  'required',
            'private'   =>  'required|numeric',
            'status'    =>  'required|numeric',
        ];
    }


    public function messages()
    {
        return [
            'cateid.required'   =>  '请选择帖子栏目',
            'cateid.numeric'    =>  '栏目选择不合法',
            'name.required'     =>  '请输入帖子标题',
            'name.string'       =>  '帖子标题不合法',
            'thumb.required'    =>  '请上传封面图片',
            'private.required'  =>  '请选择是否私有',
            'private.numeric'   =>  '是否私有不合法',
            'status.required'   =>  '请选择状态',
            'status.numeric'    =>  '状态不合法',
        ];
    }

}
